import { APP_PIPE } from '@nestjs/core';
import { Module, Global, NestModule, MiddlewareConsumer } from '@nestjs/common';
import { UserController } from './user.controller'
import { UserService } from './user.service'
import { ShareModule } from '../../share/share.module';
import { LoggerMiddleware } from 'src/common/middleware/logger.middleware';
import { commonProvider, factoryProvider } from './custom.provider'
import { ValidationPipe } from 'src/share/pipe/validate'

@Global()
@Module({
  imports: [ShareModule],
  controllers: [UserController],
  providers: [UserService, commonProvider, {
    provide: APP_PIPE,
    useClass: ValidationPipe
  }],
  exports: [UserService]
})
export class UserModule {
  // configure(consumer: MiddlewareConsumer) {
  //   consumer.apply(LoggerMiddleware).forRoutes('user')
  // }
}
